package com.grt.admin.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.grt.admin.domain.ContactUsMSG;
import com.grt.admin.domain.dto.ContactUsMSGDTO;
import com.grt.admin.service.impl.ContactUsMSGServiceImpl;
import com.grt.common.BaseVo;
import com.grt.common.convert.impl.ContactUsMSGDTOConvertDO;

@Controller
@RequestMapping(value = "/admin")
public class ContactUsMSGController {

	@Autowired
	private ContactUsMSGServiceImpl contactUsMSGService;

	@Autowired
	private ContactUsMSGDTOConvertDO contactUsMSGDTOConvertDO;

	private static final Logger logger = LoggerFactory.getLogger(ContactUsMSGController.class);

	/**
	 * 保存信息
	 * 
	 * @param oContactUsMSGDTO
	 *            在C层使用DTO对象是对象需要校验属性
	 * @return
	 */
	@ResponseBody
	@PostMapping("/saveMSG")
	public BaseVo<ContactUsMSG> saveMSG(ContactUsMSGDTO oContactUsMSGDTO) {

		BaseVo<ContactUsMSG> vo = new BaseVo<ContactUsMSG>();

		ContactUsMSG oContactUsMSG = contactUsMSGDTOConvertDO.convert(oContactUsMSGDTO);

		oContactUsMSG = contactUsMSGService.saveMSG(oContactUsMSG);

		vo.setDatas(oContactUsMSG);

		return vo;
	}

}
